/******************************************************************************
 * * mmi_modem_adaptor_call.h - data structure for mmi-modem adpator, call sub-module
 *
 * *(C) Copyright 2019 Asr International Ltd.
 * * All Rights Reserved
 * ******************************************************************************/
#ifndef MMI_MODEM_ADAPTOR_CALL_H
#define MMI_MODEM_ADAPTOR_CALL_H

#ifdef __cplusplus
extern "C" {
#endif

#include "mmi_modem_adaptor_main.h"
#include "mmi_modem_adaptor_nw.h"

/******************************************************************************
 *
 *         Message structure of MMI -> Modem Adaptor
 *
 *******************************************************************************/

// msg stru: MMI_MODEMADP_CALL_DIAL
typedef struct {
    MMI_MODEM_SIM_ID            SimId;
    INT8                        *Number;
    MMI_MODEM_CALL_SERVICE_TYPE ServiceType;
} MMI_Modemadp_Call_Dial_t;

// msg stru: MMI_MODEMADP_CALL_HANGUP
typedef struct {
    MMI_MODEM_SIM_ID SimId;
    INT32            Index;
} MMI_Modemadp_Call_Hangup_t;

// msg stru: MMI_MODEMADP_CALL_HANGUP_WAITING_OR_BG
typedef struct {
    MMI_MODEM_SIM_ID SimId;
} MMI_Modemadp_Call_Hangup_Waiting_Or_Bg_t;

// msg stru: MMI_MODEMADP_CALL_HANGUP_FG_RESUME_BG
typedef struct {
    MMI_MODEM_SIM_ID SimId;
} MMI_Modemadp_Call_Hangup_Fg_Resume_Bg_t;

// msg stru: MMI_MODEMADP_CALL_SWITCH_WAITING_OR_HOLDING_AND_ACTIVE
typedef struct {
    MMI_MODEM_SIM_ID SimId;
} MMI_Modemadp_Call_Switch_Waiting_Or_Holding_And_Active_t;

// msg stru: MMI_MODEMADP_CALL_CONF
typedef struct {
    MMI_MODEM_SIM_ID SimId;
} MMI_Modemadp_Call_Conf_t;

// msg stru: MMI_MODEMADP_CALL_SEPERATE_CONN
typedef struct {
    MMI_MODEM_SIM_ID SimId;
    INT32            Index;
} MMI_Modemadp_Call_Seperate_Conn_t;

// msg stru: MMI_MODEMADP_CALL_EXPLICIT_CALL_TRANSFER
typedef struct {
    MMI_MODEM_SIM_ID SimId;
} MMI_Modemadp_Call_Ect_t;

// msg stru: MMI_MODEMADP_CALL_UDUB
typedef struct {
    MMI_MODEM_SIM_ID SimId;
} MMI_Modemadp_Call_Udub_t;

// msg stru: MMI_MODEMADP_CALL_ANSWER
typedef struct {
    MMI_MODEM_SIM_ID SimId;
} MMI_Modemadp_Call_Answer_t;

// msg stru: MMI_MODEMADP_CALL_DTMF
typedef struct {
    MMI_MODEM_SIM_ID              SimId;
    MMI_Modem_Call_Request_Dtmf_t *Dtmf;
} MMI_Modemadp_Call_Dtmf_t;

// msg stru: MMI_MODEMADP_CALL_DTMF_START
typedef struct {
    MMI_MODEM_SIM_ID SimId;
    INT8             Dtmf;
} MMI_Modemadp_Call_Dtmf_Start_t;

// msg stru: MMI_MODEMADP_CALL_DTMF_STOP
typedef struct {
    MMI_MODEM_SIM_ID SimId;
} MMI_Modemadp_Call_Dtmf_Stop_t;

// msg stru: MMI_MODEMADP_CALL_SET_MUTE
typedef struct {
    MMI_MODEM_SIM_ID SimId;
    INT32            Mute;
} MMI_Modemadp_Call_Set_Mute_t;

// msg stru: MMI_MODEMADP_CALL_REQUEST_IMEI
typedef struct {
    MMI_MODEM_SIM_ID SimId;
} MMI_Modemadp_Call_Request_Imei_t;

/******************************************************************************
 *
 *         Message structure of RIL -> Modem Adaptor
 *
 *******************************************************************************/
// msg stru: RIL_MODEMADP_CC_RSP_GET_CUR_CALLS
typedef struct {
    RIL_Errno Result;
    RIL_CC_REQUEST_GET_CURRENT_CALLS *Calls;
} RIL_Modemadp_Cc_Rsp_Get_Cur_Calls_t;
// msg stru: RIL_MODEMADP_CC_RSP_CLCC
typedef struct {
    RIL_SIM_ID SimId;
    char       *ClccString;
} RIL_Modemadp_Cc_Rsp_Clcc_t;

// msg stru: RIL_MODEMADP_CC_RSP_CCWA
typedef struct {
    RIL_SIM_ID SimId;
    char       *CcwaString;
} RIL_Modemadp_Cc_Rsp_Ccwa_t;

// msg stru: RIL_MODEMADP_CC_RSP_RING
typedef struct {
    RIL_SIM_ID SimId;
    char       *Ring_s;
} RIL_Modemadp_Cc_Rsp_Ring_t;

// msg stru: RIL_MODEMADP_CC_RSP_NO_CARRIER
typedef struct {
    RIL_SIM_ID SimId;
    char       *NoCarrier_s;
} RIL_Modemadp_Cc_Rsp_No_Carrier_t;

// msg stru: RIL_MODEMADP_CC_RSP_DIAL
typedef struct {
    RIL_SIM_ID SimId;
    char       *RspDial_s;
} RIL_Modemadp_Cc_Rsp_Dial_t;

// msg stru: RIL_MODEMADP_CC_RSP_CONN
typedef struct {
    RIL_SIM_ID SimId;
    char       *Conn_s;
} RIL_Modemadp_Cc_Rsp_Conn_t;

// msg stru: RIL_MODEMADP_CC_RSP_CLIP
typedef struct {
    RIL_SIM_ID SimId;
    char       *Clip_s;
} RIL_Modemadp_Cc_Rsp_Clip_t;

// msg stru: RIL_MODEMADP_CC_RSP_CMUT
typedef struct {
    RIL_SIM_ID SimId;
    int        mute;
    RIL_Errno  result;
} RIL_Modemadp_Cc_Rsp_Cmut_t;

// msg stru: RIL_MODEMADP_CC_RSP_GET_IMEI
typedef struct {
    RIL_SIM_ID SimId;
    char       *p_imei;
    RIL_Errno  result;
} RIL_Modemadp_Cc_Rsp_Get_Imei_t;

typedef enum
{
    MODEM_GET_CUR_CALL_INV = 0,
    MODEM_GET_CUR_CALLS_RES,
    MODEM_CALL_DIAL,
    MODEM_RSP_CCWA,
    MODEM_RSP_RING
} MODEM_GET_CUR_CALLS_CAUSE;

typedef struct {
    MODEM_GET_CUR_CALLS_CAUSE  GetCurCallsCau;                  // the cause of which calls the get current calls interface
    MMI_Modem_Call_Response_Ccwa_t  * CcwaInfo;
    MMI_MODEM_SIM_ID OperatingSim;                              // SIM in operating
    UINT8            FgActiveCall;                              // the index of CallIndex[] array
    BOOL             DualCallPresent;                           // set to true when dual call present
    BOOL             BufferHangUp;                              // set to true if hang up message is buffered
    BOOL             Ccwa;                                      // set to true if receive a waiting call
    BOOL             RequestDial;
#define MODEM_CALL_MAX_CONN    2                                // max concurrently call connection
    int              CallIndex[MODEM_CALL_MAX_CONN];

    INT8             *Imei[2];
} Modem_Call_Mng_t;

extern Modem_Call_Mng_t g_ModemCallMng;
extern MMI_MODEM_CALL_STATE MMI_ModemAdp_Get_UI_Call_State(RIL_CallState RilCallState);
#ifdef __cplusplus
} /* extern "C" */
#endif

#endif /*SETTING_CALL_H*/
